//
//  CaiPiaoLogic.m
//  EasyToo
//
//  Created by linshengqin on 13-9-14.
//
//

#import "CaiPiaoLogic.h"
#import "CaiPiaoModel.h"

@implementation CaiPiaoLogic

static CaiPiaoLogic* caipiao_logic = nil;
+(CaiPiaoLogic*) shareInstance
{
    if(caipiao_logic == nil)
    {
        caipiao_logic = [[CaiPiaoLogic alloc] init];
    }
    return caipiao_logic;
}

-(NSComparisonResult)cmpTime
{
    NSDate* date = [NSDate date];
    CaiPiaoModel* caipiao_model = [CaiPiaoModel sharedata];
    NSDate* endDate = [self stringToDate:caipiao_model.endTime];
    return [date compare:endDate];
}

-(NSDate *) stringToDate:(NSString*)string
{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSDate *date = [dateFormatter dateFromString:string];
    [dateFormatter release];
    return date;
}

//随机出n个球
-(NSMutableArray*) randBall:(int)n
{
    
}
@end
